// 计算row高度
// var h = $(".home-row").outerHeight();
// $("#home-charts-one").height("400px");
// $("#home-charts-two").height("400px");
// $("#home-charts-three").height("400px");
// $("#home-charts-four").height("400px");

var myChartOne = echarts.init(document.getElementById('home-charts-one'));
option1 = {
    title: {
        text: '月度限上增速趋势分析',
        x: 'center',
        textStyle: {
            color: '#528cd0'
        }
    },
    tooltip: {
        trigger: 'axis'
    },
    grid: {
        top: '90px'
    },
    xAxis: {
        type: 'category',
        data: ['2018/2', '2018/3', '2018/4', '2018/5', '2018/6', '2018/7', '2018/8', '2018/9', '2018/10', '2018/11', '2018/12']
    },
    yAxis: {
        type: 'value',
        name: '单位（%）',
        max: 15,
    },
    series: [{
        data: [10.7, 11.5, 12.1, 12.1, 12.4, 12.4, 12.3, 12.4, 12.1, 11.6, 11.5],
        type: 'line'
    }]
};

myChartOne.setOption(option1);

var myChartTwo = echarts.init(document.getElementById('home-charts-two'));
option2 = {
    title: {
        text: '月度限上增速同比趋势分析',
        x: 'center',
        textStyle: {
            color: '#528cd0'
        }
    },
    tooltip: {
        trigger: 'axis'
    },
    grid: {
        top: '90px',
        right: '100px'
    },
    legend: {
        orient: 'vertical',
        right: '0',
        top: "90px",
        data: ['2019年', '2018年']
    },
    xAxis: {
        type: 'category',
        data: ['2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
    },
    yAxis: {
        type: 'value',
        name: '单位（%）',
        max: 15,
    },
    series: [{
            name: '2019年',
            type: 'line',
            stack: '增幅1',
            data: [10.4, 10.3, 9.1,8.9,9.8],
        },
        {
            name: '2018年',
            type: 'line',
            stack: '增幅2',
            data: [10.7, 11.5, 12.1, 12.1, 12.4, 12.4, 12.3, 12.4, 12.1, 11.6, 11.5],
        },
    ]
};

myChartTwo.setOption(option2);

var myChartThree = echarts.init(document.getElementById('home-charts-three'));
option3 = {
    title: {
        text: '月度限上增速全国对比分析',
        x: 'center',
        textStyle: {
            color: '#528cd0'
        }
    },
    tooltip: {
        trigger: 'axis'
    },
    grid: {
        top: '90px',
        right: '100px'
    },
    legend: {
        orient: 'vertical',
        right: '0',
        top: "90px",
        data: ['国家', '安徽省']
    },
    xAxis: {
        type: 'category',
        data: ['2018/2', '2018/3', '2018/4', '2018/5', '2018/6', '2018/7', '2018/8', '2018/9', '2018/10', '2018/11', '2018/12']
    },
    yAxis: {
        type: 'value',
        name: '单位（%）',
        max: 15,
    },
    series: [{
            name: '国家',
            type: 'line',
            stack: '总量1',
            data: [8.3, 8.5, 8.4, 7.8, 7.5, 7.3, 7.1, 6.9, 6.6, 6.1, 5.7]
        },
        {
            name: '安徽省',
            type: 'line',
            stack: '总量2',
            data: [10.7, 11.5, 12.1, 12.1, 12.4, 12.4, 12.3, 12.4, 12.1, 11.6, 11.5]
        },
    ]
};

myChartThree.setOption(option3);

var myChartFour = echarts.init(document.getElementById('home-charts-four'));
option4 = {
    title: {
        text: '月度社零结构性权重对比分析',
        x: 'center',
        textStyle: {
            color: '#528cd0'
        }
    },
    tooltip: {
        trigger: 'axis'
    },
    grid: {
        top: '90px',
        right: '100px'
    },
    legend: {
        orient: 'vertical',
        right: '0',
        top: "90px",
        data: ['汽车类', '石油类', '粮油食品类', '家电类', '服装类', '烟酒类']
    },
    xAxis: {
        type: 'category',
        data: ['2018/2', '2018/3', '2018/4', '2018/5', '2018/6', '2018/7', '2018/8', '2018/9', '2018/10', '2018/11', '2018/12']
    },
    yAxis: {
        type: 'value',
        name: '比重',
    },
    series: [{
            name: '汽车类',
            type: 'line',
            stack: '总量1',
            data: [0.33,
                0.35,
                0.35,
                0.35,
                0.35,
                0.35,
                0.35,
                0.35,
                0.35,
                0.35,
                0.35
            ]
        },
        {
            name: '石油类',
            type: 'line',
            stack: '总量2',
            data: [
                0.18,
                0.18,
                0.19,
                0.19,
                0.19,
                0.19,
                0.19,
                0.19,
                0.19,
                0.19,
                0.19
            ]
        },
        {
            name: '粮油食品类',
            type: 'line',
            stack: '总量3',
            data: [0.21,
                0.20,
                0.19,
                0.18,
                0.18,
                0.18,
                0.18,
                0.18,
                0.18,
                0.18,
                0.18
            ]
        },
        {
            name: '家电类',
            type: 'line',
            stack: '总量4',
            data: [0.10,
                0.11,
                0.11,
                0.12,
                0.12,
                0.12,
                0.12,
                0.12,
                0.12,
                0.12,
                0.12
            ]
        },
        {
            name: '服装类',
            type: 'line',
            stack: '总量5',
            data: [0.10,
                0.09,
                0.09,
                0.09,
                0.09,
                0.09,
                0.09,
                0.09,
                0.09,
                0.09,
                0.09
            ]
        },
        {
            name: '烟酒类',
            type: 'line',
            stack: '总量6',
            data: [0.08,
                0.08,
                0.07,
                0.07,
                0.07,
                0.07,
                0.07,
                0.07,
                0.07,
                0.07,
                0.07
            ]
        },
    ]
};

myChartFour.setOption(option4);

$('#oneYear').on('change', function() {
    if ($(this).val() == "2019年") {
        oneoption1 = {
            title: {
                text: '月度限上增速趋势分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                top: '90px'
            },
            xAxis: {
                type: 'category',
                data: ['2019/2', '2019/3', '2019/4','2019/5','2019/6']
            },
            yAxis: {
                type: 'value',
                name: '单位（%）',
                max: 15,
            },
            series: [{
                data: [10.4, 10.3, 9.1,8.9,9.8],
                type: 'line'
            }]
        };

        myChartOne.setOption(oneoption1);
    } else {
        oneoption2 = {
            title: {
                text: '月度限上增速趋势分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                top: '90px'
            },
            xAxis: {
                type: 'category',
                data: ['2018/2', '2018/3', '2018/4', '2018/5', '2018/6', '2018/7', '2018/8', '2018/9', '2018/10', '2018/11', '2018/12']
            },
            yAxis: {
                type: 'value',
                name: '单位（%）',
                max: 15,
            },
            series: [{
                data: [10.7, 11.5, 12.1, 12.1, 12.4, 12.4, 12.3, 12.4, 12.1, 11.6, 11.5],
                type: 'line'
            }]
        };

        myChartOne.setOption(oneoption2);
    }
})
$('#twoYear').on('change', function() {
    if ($(this).val() == "2019年") {
        twooption2 = {
            title: {
                text: '月度限上增速同比趋势分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            grid: {
                top: '90px',
                right: '100px'
            },
            legend: {
                orient: 'vertical',
                right: '0',
                top: "90px",
                data: ['2019年', '2018年']
            },
            xAxis: {
                type: 'category',
                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月']
            },
            yAxis: {
                type: 'value',
                name: '单位（%）',
            },
            series: [{
                    name: '2019年',
                    type: 'line',
                    stack: '总量1',
                    data: [234, 146, 75, 183, 345, 123, 210]
                },
                {
                    name: '2018年',
                    type: 'line',
                    stack: '总量2',
                    data: [22, 159, 223, 334, 256, 123, 765]
                },
            ]
        };

        myChartTwo.setOption(twooption2);
    } else {
        twooption1 = {
            title: {
                text: '月度限上增速同比趋势分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            grid: {
                top: '90px',
                right: '100px'
            },
            legend: {
                orient: 'vertical',
                right: '0',
                top: "90px",
                data: ['2019年', '2018年']
            },
            xAxis: {
                type: 'category',
                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月']
            },
            yAxis: {
                type: 'value',
                name: '单位（%）',
            },
            series: [{
                    name: '2019年',
                    type: 'line',
                    stack: '总量1',
                    data: [120, 132, 101, 134, 90, 230, 210]
                },
                {
                    name: '2018年',
                    type: 'line',
                    stack: '总量2',
                    data: [100, 182, 191, 234, 290, 330, 310]
                },
            ]
        };

        myChartTwo.setOption(twooption1);
    }
})
$('#threeYear').on('change', function() {
    if ($(this).val() == "2019年") {
        threeOption2 = {
            title: {
                text: '月度限上增速全国对比分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                top: '90px',
                right: '100px'
            },
            legend: {
                orient: 'vertical',
                right: '0',
                top: "90px",
                data: ['国家', '安徽省']
            },
            xAxis: {
                type: 'category',
                data: ['2019/2', '2019/3', '2019/4','2019/5','2019/6']
            },
            yAxis: {
                type: 'value',
                name: '单位（%）',
                max: 15,
            },
            series: [{
                    name: '国家',
                    type: 'line',
                    stack: '总量1',
                    data: [3.5, 4.1, 3.5,3.9,4.9]
                },
                {
                    name: '安徽省',
                    type: 'line',
                    stack: '总量2',
                    data: [10.4, 10.3, 9.1,8.9,9.8]
                },
            ]
        };

        myChartThree.setOption(threeOption2);
    } else {
        threeOption1 = {
            title: {
                text: '月度限上增速全国对比分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                top: '90px',
                right: '100px'
            },
            legend: {
                orient: 'vertical',
                right: '0',
                top: "90px",
                data: ['国家', '安徽省']
            },
            xAxis: {
                type: 'category',
                data: ['2018/2', '2018/3', '2018/4', '2018/5', '2018/6', '2018/7', '2018/8', '2018/9', '2018/10', '2018/11', '2018/12']
            },
            yAxis: {
                type: 'value',
                name: '单位（%）',
                max: 15,
            },
            series: [{
                    name: '国家',
                    type: 'line',
                    stack: '总量1',
                    data: [8.3, 8.5, 8.4, 7.8, 7.5, 7.3, 7.1, 6.9, 6.6, 6.1, 5.7]
                },
                {
                    name: '安徽省',
                    type: 'line',
                    stack: '总量2',
                    data: [10.7, 11.5, 12.1, 12.1, 12.4, 12.4, 12.3, 12.4, 12.1, 11.6, 11.5]
                },
            ]
        };

        myChartThree.setOption(threeOption1);
    }
})
$('#fourYear').on('change', function() {
    if ($(this).val() == "2019年") {
        fourOption2 = {
            title: {
                text: '月度社零结构性权重对比分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                top: '90px',
                right: '100px'
            },
            legend: {
                orient: 'vertical',
                right: '0',
                top: "90px",
                data: ['汽车类', '石油类', '粮油食品类', '家电类', '服装类', '烟酒类']
            },
            xAxis: {
                type: 'category',
                data: ['2019/2', '2019/3', '2019/4','2019/5','2019/6']
            },
            yAxis: {
                type: 'value',
                name: '比重',
            },
            series: [{
                    name: '汽车类',
                    type: 'line',
                    stack: '总量1',
                    data: [0.32, 0.32, 0.32,0.32,0.31]
                },
                {
                    name: '石油类',
                    type: 'line',
                    stack: '总量2',
                    data: [0.20, 0.20, 0.21, 0.21, 0.21]
                },
                {
                    name: '粮油食品类',
                    type: 'line',
                    stack: '总量3',
                    data: [0.22, 0.21, 0.21,, 0.20, 0.20]
                },
                {
                    name: '家电类',
                    type: 'line',
                    stack: '总量4',
                    data: [0.10, 0.11, 0.11,0.11,0.12]
                },
                {
                    name: '服装类',
                    type: 'line',
                    stack: '总量5',
                    data: [0.09, 0.09, 0.09, 0.09, 0.09]
                },
                {
                    name: '烟酒类',
                    type: 'line',
                    stack: '总量6',
                    data: [0.07, 0.07, 0.07, 0.07, 0.07]
                },
            ]
        };

        myChartFour.setOption(fourOption2);
    } else {
        fourOption1 = {
            title: {
                text: '月度社零结构性权重对比分析',
                x: 'center',
                textStyle: {
                    color: '#528cd0'
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                top: '90px',
                right: '100px'
            },
            legend: {
                orient: 'vertical',
                right: '0',
                top: "90px",
                data: ['汽车类', '石油类', '粮油食品类', '家电类', '服装类', '烟酒类']
            },
            xAxis: {
                type: 'category',
                data: ['2018/2', '2018/3', '2018/4', '2018/5', '2018/6', '2018/7', '2018/8', '2018/9', '2018/10', '2018/11', '2018/12']
            },
            yAxis: {
                type: 'value',
                name: '比重',
            },
            series: [{
                    name: '汽车类',
                    type: 'line',
                    stack: '总量1',
                    data: [0.33,
                        0.35,
                        0.35,
                        0.35,
                        0.35,
                        0.35,
                        0.35,
                        0.35,
                        0.35,
                        0.35,
                        0.35
                    ]
                },
                {
                    name: '石油类',
                    type: 'line',
                    stack: '总量2',
                    data: [
                        0.18,
                        0.18,
                        0.19,
                        0.19,
                        0.19,
                        0.19,
                        0.19,
                        0.19,
                        0.19,
                        0.19,
                        0.19
                    ]
                },
                {
                    name: '粮油食品类',
                    type: 'line',
                    stack: '总量3',
                    data: [0.21,
                        0.20,
                        0.19,
                        0.18,
                        0.18,
                        0.18,
                        0.18,
                        0.18,
                        0.18,
                        0.18,
                        0.18
                    ]
                },
                {
                    name: '家电类',
                    type: 'line',
                    stack: '总量4',
                    data: [0.10,
                        0.11,
                        0.11,
                        0.12,
                        0.12,
                        0.12,
                        0.12,
                        0.12,
                        0.12,
                        0.12,
                        0.12
                    ]
                },
                {
                    name: '服装类',
                    type: 'line',
                    stack: '总量5',
                    data: [0.10,
                        0.09,
                        0.09,
                        0.09,
                        0.09,
                        0.09,
                        0.09,
                        0.09,
                        0.09,
                        0.09,
                        0.09
                    ]
                },
                {
                    name: '烟酒类',
                    type: 'line',
                    stack: '总量6',
                    data: [0.08,
                        0.08,
                        0.07,
                        0.07,
                        0.07,
                        0.07,
                        0.07,
                        0.07,
                        0.07,
                        0.07,
                        0.07
                    ]
                },
            ]
        };

        myChartFour.setOption(fourOption1);
    }
})